package com.dingding.study.Event.serviceImpl;


import com.dingding.study.Event.service.EventCenter;

public class DomainEventPublisher {

    private static DomainEventPublisher instance = new DomainEventPublisher();

    private EventCenter eventCenter = EventCenter.DEFAULT_EVENT_CENTER;

    public static DomainEventPublisher getInstance() {
        return instance;
    }

    public <T extends DomainEvent<?>> void publish(T event) {
        eventCenter.publish(event);
    }

    public <T extends DomainEvent<?>> void subscrible(DomainEventListener<T> listener) {
        eventCenter.subscribe(listener);
    }

}
